<template>
  <!-- 鱼塘明细 -->
  <div class="fishpondInformation">
    <div class="title"> 鱼塘明细 </div>
    <div class="content comflex">
      <div class="fishpond" v-for="(item, index) in batchList" :key="index">
        <div class="info">
          <div class="comflex fishpondLable">
            <div class="label">鱼塘名称：{{ item.pondName }}</div>
          </div>
          <div class="comflex fishpondInfo">
            <div class="item">
              <span class="titleName">鱼塘所在区域：</span>{{ item.pondArea }}
            </div>
            <div class="item">
              <span class="titleName">鱼塘面积：</span>{{ item.fishpondArea + item.areaUnitTypeStr }}
            </div>
            <div class="item">
              <span class="titleName">鱼塘使用率：</span>{{ item.useRatio }}%
            </div>
          </div>
          <div class="btn comflex">
            <el-button plain class="more" @click="showDialogVisible(item.batchInfoList)">查看使用状态</el-button>
          </div>
        </div>
      </div>
    </div>
    <el-dialog title="投塘信息" :visible.sync="dialogVisible" width="30%">
      <el-table :data="batchInfo" border>
        <el-table-column prop="batchName" label="批次编号" width="150">
        </el-table-column>
        <el-table-column prop="count" label="投塘次数" width="100">
        </el-table-column>
        <el-table-column prop="varietyName" label="投塘品种" width="150">
        </el-table-column>
        <el-table-column prop="totalNum" label="总投塘条数" width="150">
        </el-table-column>
        <el-table-column prop="totalWeight" label="总投塘重量(斤)" width="150">
        </el-table-column>
        <el-table-column label="状态">
          <template slot-scope="scope">
            <p>{{ scope.row.closePondFlag ? '已封塘' : '未封塘' }}</p>
          </template>
        </el-table-column>
      </el-table>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>

import { mymixin } from "@/utils/mixins";
import BatchMangeApi from "@/api/batch-mange"
export default {
  name: "baseformation",
  props: {},
  mixins: [mymixin],
  data () {
    return {
      dialogVisible: false,
      batchList: '',
      batchInfo: [],
    }
  },
  watch: {},
  created () { },
  mounted () {
    this.init()
  },
  methods: {
    init () {
      this.queryPondPageList()//查询投塘信息
    },
    showDialogVisible (data) {
      this.dialogVisible = true
      this.batchInfo = data ? data : []
      console.log(data)
    },
    //查询投塘信息
    queryPondPageList () {
      BatchMangeApi.queryPondPageByCondition({}).then((res) => {
        if (res.success) {
          this.batchList = res.data ? res.data: []
        } else {
          this.batchList = []
        }
      })
    },
  }
};
</script>
<style scoped lang="scss">
.comflex {
  display: flex;
  justify-content: flex-start;
}

.item-center {
  align-items: center;
}

.fishpondInformation {
  width: 100%;
  margin: 15px 0;
  box-shadow: 1px 1px 50px 10px #eaeaea;
  border-radius: 10px;
  border: 1px solid #e9e9e9;

  ::v-deep .el-dialog__header {
    background-color: #237FC3 !important;
  }

  .title {
    width: 100%;
    height: 50px;
    padding-left: 20px;
    border-radius: 10px 10px 0 0;
    background-image: linear-gradient(45deg, #03a9f4, #58caff);
    font-size: 16px;
    line-height: 50px;
    color: #ffffff;
  }

  .content {
    padding: 15px;
    flex-wrap: wrap;

    .fishpond {
      width: calc(100% / 3);
      padding: 10px;
      box-sizing: border-box;

      .info {
        border-radius: 6px;
        padding: 20px;
        background-color: #ffffff;
        background-image: url("~@/assets/ssLogo.png");
        background-repeat: no-repeat;
        background-position: 270px -70px;
        background-size: 150px 150px;
        transition: all 0.3s;

        .btn {
          width: 100%;
          justify-content: end;
        }

        .fishpondLable {
          justify-content: space-between;
          align-items: center;

          ::v-deep .el-button {
            background: #d7f2ff;
            border: 1px solid #03a9f4;
            color: #03a9f4;
          }

          .label {
            width: 100%;
            font-size: 16px;
            font-weight: bold;
            color: #03a9f4;
            justify-content: space-between;
          }

          .more {
            font-size: 12px;
            cursor: pointer;
          }
        }

        .fishpondInfo {
          padding-top: 20px;
          font-size: 14px;
          flex-wrap: wrap;

          .item {
            width: 100%;
            font-size: 14px;
            line-height: 28px;
            color: #666666;

            .titleName {
              color: #bbbbbb;
              padding-right: 15px;
            }
          }
        }
      }
    }

    .fishpond:hover>.info {
      background-color: rgb(55, 211, 197);

      ::v-deep .el-button {
        background: rgb(142, 255, 246);
        border: 1px solid rgb(25, 148, 137);
        color: rgb(55, 211, 197);
      }

      .item,
      .item>.titleName {
        color: #ffffff;
      }


      .label {
        color: rgb(25, 148, 137);
      }
    }
  }
}
::v-deep .el-dialog__wrapper .el-dialog{
  margin-top: 15vh !important;
}
</style>
